Page({
  data: {},
  showToast: function () {
    wx.showToast({
      title: '成功',
      icon: 'success'
    })
  },
  showModal: function () {
    wx.showModal({
      title: '系统提示',
      content: '你确定要进行以上操作吗？',
      //editable:true,
      success: (res) => {
        console.log(res)
        if (res.cancel) {
          wx.showToast({
            title: '你点击了取消按钮',
            icon:'error'
          })
        }
        if (res.confirm) {
          wx.showToast({
            title: '你点击了确定按钮',
            icon:'success'
          })
        }
      }
    })
  },
  showLoading: function () {
    wx.showLoading({
      title: '装入中',
    });
    setTimeout(() => {
      wx.hideLoading();
    }, 3000);
  },
  showActionSheet: function () {
    wx.showActionSheet({
      //alertText:'警示一下',   //该项目写上也没有效果
      itemList: ['转向表单demo', '返回首页', '转向picker'],
      success: function (resp) {
        switch (resp.tapIndex) {  //tapIndex是点击的序号，从上到下，从0开始计数
          case 0:
            wx.navigateTo({
              url: '/pages/images/images',
            })
            break;
          case 1:
            wx.navigateTo({
              url: '/pages/index/index',
            })
            break;
          case 2:
            wx.navigateTo({
              url: '/pages/picker/picker',
            })
            break;
        }
      }
    })
  }
})